package com.example.application1;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

public class UnitAdapter extends RecyclerView.Adapter<UnitAdapter.UnitViewHolder> {

    private Context mContext;

    public UnitAdapter(Context context) {
        this.mContext = context;
    }

    @NonNull
    @Override
    public UnitAdapter.UnitViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new UnitViewHolder(LayoutInflater.from(mContext).inflate(R.layout.layout_unit_item, parent, false));
    }

    @Override
    public void onBindViewHolder(@NonNull UnitAdapter.UnitViewHolder holder, int position) {
        holder.textView.setText("TOUR " + (position + 1));
    }

    @Override
    public int getItemCount() {
        return 4;
    }

    class UnitViewHolder extends RecyclerView.ViewHolder {

        private TextView textView;

        public UnitViewHolder(@NonNull View itemView) {
            super(itemView);
            textView = itemView.findViewById(R.id.tv_tour);
        }
    }
}
